package com.wyfan.scaffold.common.config.redis;

import lombok.Data;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * redis 实例， 多数据源添加多个template 修改选择 RedisProperties 配置的属性类即可
 */
@Data
@Configuration
public class RedisInstance {

	/**
	 * 数据源
	 */
	@Bean
	public StringRedisTemplate baseRedisTemplate(RedisConfig redisConfig) {
		return RedisFactory.createStringRedisTemplate(redisConfig.base);
	}

}
